package com.hxc.web.controller.interest;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hxc.common.annotation.Log;
import com.hxc.common.core.controller.BaseController;
import com.hxc.common.core.domain.AjaxResult;
import com.hxc.common.enums.BusinessType;
import com.hxc.interest.domain.TReactionUser;
import com.hxc.interest.service.ITReactionUserService;
import com.hxc.common.utils.poi.ExcelUtil;
import com.hxc.common.core.page.TableDataInfo;

/**
 * 用户和反馈信息中间Controller
 * 
 * @author hxc
 * @date 2021-08-19
 */
@Api(tags = " 用户和反馈中间表")
@RestController
@RequestMapping("/interest/reactionUser")
public class TReactionUserController extends BaseController
{
    @Autowired
    private ITReactionUserService tReactionUserService;

    /**
     * 查询用户和反馈信息中间列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TReactionUser tReactionUser)
    {
        startPage();
        List<TReactionUser> list = tReactionUserService.selectTReactionUserList(tReactionUser);
        return getDataTable(list);
    }

    /**
     * 导出用户和反馈信息中间列表
     */
    @Log(title = "用户和反馈信息中间", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TReactionUser tReactionUser)
    {
        List<TReactionUser> list = tReactionUserService.selectTReactionUserList(tReactionUser);
        ExcelUtil<TReactionUser> util = new ExcelUtil<TReactionUser>(TReactionUser.class);
        return util.exportExcel(list, "用户和反馈信息中间数据");
    }

    /**
     * 获取用户和反馈信息中间详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tReactionUserService.selectTReactionUserById(id));
    }

    /**
     * 新增用户和反馈信息中间
     */
    @ApiOperation(value = "新增用户反馈中间信息(转发功能)", notes = "查询")
    @Log(title = "用户和反馈信息中间", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TReactionUser tReactionUser)
    {
        return toAjax(tReactionUserService.insertTReactionUser(tReactionUser));
    }

    /**
     * 修改用户和反馈信息中间
     */
    @Log(title = "用户和反馈信息中间", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TReactionUser tReactionUser)
    {
        return toAjax(tReactionUserService.updateTReactionUser(tReactionUser));
    }

    /**
     * 删除用户和反馈信息中间
     */
    @Log(title = "用户和反馈信息中间", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tReactionUserService.deleteTReactionUserByIds(ids));
    }

}
